import card

class Cards():

    def __init__(self):
        self.CardDict = {}
        self.CardCount = 0

        self.PopulateDict()

    def AddCard(self, card):
        self.CardDict[card.CardID] = card
        self.CardCount += 1

    def GetCardByID(self, card_id):
        return self.CardDict[card_id]

    def GetSortedValues(self):
        values = self.CardDict.values()
        values.sort(lambda x, y: cmp(x.Name, y.Name))
        return [value for value in values]

    def PopulateDict(self):
        #disgaea trial deck
        name   = 'Overlord Laharl and his Vassal Etna'
        image  = 'DG103'
        flavor = 'Prince, you\'re just a big softy! If that was me, I would\'ve wasted them all!'
        text   = ('[A] When the Battle Opponent of this becomes Reversed, if there are no '
                  'Climax Cards in your opponent\'s Waiting Room, you may choose a card in your '
                  'Waiting Room and put it in your Stock.')
        traits = ['Demon', 'Weapon']
        to_add = card.Card('DG/S02-103', name, image, 'TD', 'Green', 'Schwarz Character', 0, 0, 2500, 1,
                           traits, [], flavor, text, None)
        self.AddCard(to_add)

        name   = 'Raspberyl & Sapphire All Ready for Gym'
        image  = 'DG104'
        flavor = 'Are there really demons that are this cute? That\'s too much for me !'
        text   = ('[C] If there are 4 or more Climax cards in your Waiting Room, this gains '
                '"[A] ENCORE [Discard a Character card from your hand to the Waiting Room]"')
        traits = ['Demon', 'Sports']
        to_add = card.Card('DG/S02-104', name, image, 'TD', 'Green', 'Schwarz Character', 2, 2, 8500, 2,
                           traits, ['Soul'], flavor, text, None)
        self.AddCard(to_add)

        name   = 'Laharl & Flonne'
        image  = 'DGT01'
        flavor = 'Laharl: That\'s right! I\'m the Overlord!'
        text   = ''
        traits = ['Demon', 'Angel']
        to_add = card.Card('DG/S02-T01', name, image, 'TD', 'Green', 'Schwarz Character', 0, 0, 3000, 1,
                           traits, [], flavor, text, None)
        self.AddCard(to_add)

        name   = 'Prinny Squad'
        image  = 'DGT02'
        flavor = 'I\'ve got a bad feeling about this, dood!'
        text   = ('[C] You may have as many copies of the card with the same name as this in '
                'your deck as you wish.\n[S] [Put a ::Prinny:: Character to the Waiting Room ]'
                'Choose 1 of your opponent\'s Front Row Characters. That Character gets -1000 Power for the turn.')
        traits = ['Prinny', 'None']
        to_add = card.Card('DG/S02-T02', name, image, 'TD', 'Green', 'Schwarz Character', 0, 0, 1500, 1,
                           traits, [], flavor, text, None)
        self.AddCard(to_add)

        name   = 'Average Cleric'
        image  = 'DGT03'
        flavor = 'I am always beside you...'
        text   = ('[S] Brainstorm [(1)] Reveal the top 4 cards of your Library and put them '
                  'in your Waiting Room. For each Climax card revealed this way, choose 1 of your '
                  'Characters. That Character gains +2000 Power for the turn.')
        traits = ['God', 'Magic']
        to_add = card.Card('DG/S02-T03', name, image, 'TD', 'Green', 'Schwarz Character', 0, 0, 2000, 1,
                           traits, [], flavor, text, None)
        self.AddCard(to_add)

        name   = 'Genius Rune Knight'
        image  = 'DGT04'
        flavor = 'I can sense a demonic power from this evil room...'
        text   = ('[A] When this is placed from hand to the Stage, you may choose a Climax '
                  'card in your opponent\'s Waiting Room and return it to the Library. If you do '
                  'so, shuffle that Library, and choose 1 of your Characters. That Character gains '
                  '+3000 Power for the turn.')
        traits = ['Weapon', 'Magic']
        to_add = card.Card('DG/S02-T04', name, image, 'TD', 'Green', 'Schwarz Character', 0, 0, 2500, 1,
                           traits, [], flavor, text, None)
        self.AddCard(to_add)

        name   = 'Universe Police Justice Flonne'
        image  = 'DGT05'
        flavor = '"Love & Peace!!" to your heart!'
        text   = ('[A] When this attacks, if "Assassin from Celestia" is in your Climax '
                  'Zone, then all your Characters gain +1000 Power for the turn. '
                  '\n[S] [Rest 1 of your Characters] This card gains +1000 Power for the turn.')
        traits = ['Angel', 'Police']
        to_add = card.Card('DG/S02-T05', name, image, 'TD', 'Green', 'Schwarz Character', 1, 0, 4000, 1,
                           traits, [], flavor, text, None)
        self.AddCard(to_add)

        name   = 'Good-for-Nothing Archer'
        image  = 'DGT06'
        flavor = 'Umm, my strong point is my vertical role. Shooting weak points is my hobby.'
        text   = ('[A] When this is placed from hand to the Stage, choose 1 of your '
                  'opponent\'s Characters. That Character gets -500 Power for the turn.')
        traits = ['Weapon', 'None']
        to_add = card.Card('DG/S02-T06', name, image, 'TD', 'Green', 'Schwarz Character', 1, 1, 4500, 1,
                           traits, ['Soul'], flavor, text, None)
        self.AddCard(to_add)

        name   = 'Etna & Flonne'
        image  = 'DGT07'
        flavor = 'Flonne, you aren\'t supposed to be tainted by the demonic side, are you?'
        text   = ('[S] [Counter] BACKUP 1500, Level 1 [Discard this card from hand to the '
                  'Waiting Room]')
        traits = ['Demon', 'Angel']
        to_add = card.Card('DG/S02-T07', name, image, 'TD', 'Green', 'Schwarz Character', 1, 0, 1500, 1,
                           traits, [], flavor, text, None)
        self.AddCard(to_add)

        name   = 'Revival of the Bow'
        image  = 'DGT08'
        flavor = 'Finally... Finally returned!'
        text   = ('[Counter] Choose up to 5 non-Climax Cards in your Waiting Room and return '
                  'them to your Library. Shuffle your Library. If you returned 5 cards, choose 1 '
                  'Character in your opponent\'s Front Row. That Character gets -1500 Power for the '
                  'turn.')
        traits = ['None', 'None']
        to_add = card.Card('DG/S02-T08', name, image, 'TD', 'Green', 'Schwarz Event', 1, 0, 0, 0,
                           traits, [], flavor, text, None)
        self.AddCard(to_add)

        name   = 'Assassin from Celestia'
        image  = 'DGT09'
        flavor = 'Nice to meet you, I\'m an assassin~'
        text   = ('[C] All your Characters gain +2 Soul.')
        traits = ['None', 'None']
        to_add = card.Card('DG/S02-T09', name, image, 'TD', 'Green', 'Schwarz Climax', 0, 0, 0, 0,
                           traits, ['Soul', 'Soul'], flavor, text, None)
        self.AddCard(to_add)

        name   = 'Etna, the Overlord Assassin'
        image  = 'DGT10'
        flavor = ('I don\'t think it\'s love. If it\'s no good, I\'ll just '
                  'kill him.')
        text   = ('None')
        traits = ['Demon', 'Weapon']
        to_add = card.Card('DG/S02-T10', name, image, 'TD', 'Red', 'Schwarz Character', 0, 0, 3000, 1,
                           traits, [], flavor, text, None)
        self.AddCard(to_add)

        name   = 'Vyers, the Dark Adonis / Mid-Boss'
        image  = 'DGT11'
        flavor = ('Mi- Mi- Midboss!!?')
        text   = ('[C] ASSIST All your Characters in front of this card gain +500 Power. '
                  '\n[A] When this becomes Reversed while battling, you may return this to your '
                  'Library. If so, shuffle your Library.')
        traits = ['Demon', 'Will']
        to_add = card.Card('DG/S02-T11', name, image, 'TD', 'Red', 'Schwarz Character', 0, 0, 500, 1,
                           traits, [], flavor, text, None)
        self.AddCard(to_add)

        name   = 'Invincible Robot Thursday'
        image  = 'DGT12'
        flavor = ('GORDON KEEPS STARING AT JENNIFER\'S THIGHS,  PERVERT!')
        text   = ('[C] All your other ::Hero:: Characters and Characters with "Protagonist" '
                  'in the name gain +500 Power. \n[S] [(2) Rest this] Choose 1 Character in your '
                  'Waiting Room and return it to your hand.')
        traits = ['Mecha', 'Hero']
        to_add = card.Card('DG/S02-T12', name, image, 'TD', 'Red', 'Schwarz Character', 0, 0, 500, 1,
                           traits, [], flavor, text, None)
        self.AddCard(to_add)

        name   = 'Prince Laharl of the Netherworld'
        image  = 'DGT13'
        flavor = ('Prince Laharl, Successor of the Netherworld, that\'s me!')
        text   = ('[A] When this attacks, if "King of the Earth" is in your Climax Zone, you '
                  'may choose a card in your opponent\'s Waiting Room and put it on top of the '
                  'Library. \n[A] BOND/"Etna & Flonne" [(1)]')
        traits = ['Demon', 'Weapon']
        to_add = card.Card('DG/S02-T13', name, image, 'TD', 'Red', 'Schwarz Character', 1, 0, 3000, 1,
                           traits, [], flavor, text, None)
        self.AddCard(to_add)

        name   = 'Captain Gordon, Defender of Earth'
        image  = 'DGT14'
        flavor = ('Captain Gordon, Defender of Earth! I have arrived!!')
        text   = 'None'
        traits = ['Hero', 'Weapon']
        to_add = card.Card('DG/S02-T14', name, image, 'TD', 'Red', 'Schwarz Character', 1, 1, 6000, 1,
                           traits, [], flavor, text, None)
        self.AddCard(to_add)

        name   = 'Demon Girl Etna, the Ultimate Beauty'
        image  = 'DGT15'
        flavor = ('A beautiful girl dances in the darkness of the devil realm, next time'
                  'on "Birth of Queen Etna"!')
        text   = 'None'
        traits = ['Demon', 'Weapon']
        to_add = card.Card('DG/S02-T15', name, image, 'TD', 'Red', 'Schwarz Character', 2, 2, 9000, 2,
                           traits, ['Soul'], flavor, text, None)
        self.AddCard(to_add)

        name   = '"Beauty Baron" Mid-Boss'
        image  = 'DGT16'
        flavor = ('You\'ll regret treating me like a mid-boss!!')
        text   = ('[A] When this is placed from hand to Stage, if there are 5 or fewer cards '
                  'in your Library, return all cards in your Waiting Room to Library. If so, '
                  'shuffle that Library, and you may deal 1 damage to opponent. (Damage Cancel can '
                  'occur. \n[A] When this becomes Reversed while battling, you may return this to your '
                  'Library. If so, shuffle your Library.')
        traits = ['Demon', 'Will']
        to_add = card.Card('DG/S02-T16', name, image, 'TD', 'Red', 'Schwarz Character', 2, 1, 7500, 1,
                           traits, ['Soul'], flavor, text, None)
        self.AddCard(to_add)
